class Rudoku::FieldSelection
  attr_reader :field_selector, :field, :params
  
  def initialize(field_selector, field, params)
    @field_selector, @field, @params = field_selector, field, params
  end
  
  def reason # get a nicely formatted reason message for this particular elimination
    return nil if @field_selector.reason.nil?
    
    @field_selector.reason.gsub(/\:[a-zA-Z0-9]*/) do |match|
      match.gsub!(":", "")
      
      case match
      when "field"
        @field.position
      else
        @params[match.to_sym]
      end
    end
  end
end

